package com.scanner;

import android.content.Context;
import android.graphics.Canvas;
import android.view.View;

public class TurnView extends View {
	
	AntiClockView antiClockView;
	ClockView clockView;
	
	boolean clock = false;
	boolean antiClock = false;
	
	public TurnView(Context context) 
	{
		super(context);
		antiClockView = new AntiClockView(context);
		clockView = new ClockView(context);
	}
	
	public void Clear()
	{
		setPositions(false, false);
	}
	
	private void setPositions(boolean left, boolean right)
	{
		this.antiClock = right;
		this.clock = left;
	}
	
	public void	UpdatePosition(MoveActions action)
	{
		switch (action) {
		case TURN_CLOCK:
			setPositions(true,false);
			break;
		case TURN_ANTICLOCK:
			setPositions(false,true);
			break;
		
		case DONT_TURN:
			setPositions(false,false);
			break;

		default:
			setPositions(false,false);
			break;
		}
	}
	
	public void onDraw(Canvas canvas)
	{
		if (clock)
		{
			clockView.draw(canvas);
		}
		if (antiClock)
		{
			antiClockView.draw(canvas);
		}
	}

}
